<template>
  <div class="company-box hw-box-style-flex hw-box-style-flex-r-center" :class="{ 'nav-ava': true }">
    <div class="left-box">
      <t-avatar
        v-if="datas.logoUrl"
        size="56px"
        class="user-avatar hw-click-cursor"
        :image="urls + userStore.userCompany.logoUrl"
      />
      <t-avatar
        image="//static.jiyi.show/assets/img/companyImg.png"
        v-else
        size="56px"
        class="user-avatar hw-click-cursor"
      >
      </t-avatar>
    </div>
    <div v-if="true" class="right-box hw-box-style-flex hw-box-style-flex-clm">
      <p class="right-title-p">{{ userStore.userCompany.name }}</p>
      <!-- {{ datas.name }} -->
      <div class="banner hw-box-style-flex hw-box-style-flex-r-center hw-box-style-flex-c">
        <span>认证单位</span>
        <img src="//static.jiyi.show/assets/img/companyBg.png" alt="" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
// @ts-nocheck
import { reactive } from 'vue';
import { urls } from '@/utils/request/upload';
import { curatorlogin } from '@/api/user/user';
import { computed } from 'vue';
import { useSettingStore, useUserStore } from '@/store';
const collapsed = computed(() => useSettingStore().isSidebarCompact);
const userStore = useUserStore();
const datas = reactive({
  logoUrl: null,
  name: null,
});
const init = async () => {
  let res = await curatorlogin();
  if (res.data) {
    datas.logoUrl = res.data.companys[0]?.logoUrl;
    datas.name = res.data.companys[0]?.name;
    // setroleLevel
    userStore.setroleLevel(res.data.companys[0]?.role); //
    userStore.setuserCompany(datas);
  }
  // console.log(res.data.companys);
};
init();
</script>

<style lang="less" scoped>
.company-box {
  width: 100%;
  min-height: 100px;
  background: @color-menu-color2;
  // border-radius: @radius-hw-box1;
}
.nav-ava {
  padding: 0 24px;
}
.left-box {
  width: 56px;
  height: 56px;
}
.right-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: left;
  margin-left: 16px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  .right-title-p {
    width: 100%;
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #37372f;
    line-height: 22px;
  }
  .banner {
    position: relative;

    img {
      position: absolute;
      width: 100%;
      height: 100%;
    }
    span {
      position: relative;
      z-index: 99;
    }
    width: 84px;
    height: 28px;
    // background: @color-text-color;
    font-weight: 500;
    color: #fff;
    font-size: 12px;
    margin-top: 8px;
    line-height: 18px;
    border-radius: @radius-hw-box1;
  }
}
</style>
